package com.itqf.service.impl;

import com.itqf.bean.DtsCartExample;
import com.itqf.mapper.DtsCartMapper;
import com.itqf.service.DtsCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * projectName: gp_manage
 *
 * @author: 赵伟风
 * time: 2021/8/24 0:08
 * description:
 */

@Service
public class DtsCartServiceImpl implements DtsCartService {

    @Autowired
    private DtsCartMapper dtsCartMapper;

    /**
     * 购物车中是否存在商品
     *
     * @param id
     * @return
     */
    @Override
    public boolean checkExist(Integer id) {

        DtsCartExample cartExample = new DtsCartExample();
        DtsCartExample.Criteria criteria = cartExample.createCriteria();

        DtsCartExample.Criteria criteria1 = criteria.andGoodsIdEqualTo(id);

        long count = dtsCartMapper.countByExample(cartExample);

        return count > 0;
    }
}
